package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Interface;
import com.briup.recognition.bean.InterfaceExample;
import com.briup.recognition.dao.InterfaceMapper;
import com.briup.recognition.service.IInterfaceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: ldd
 * @Date: 2021/03/28/21:01
 * @Description:
 */
@Service
public class InterfaceServiceImpl implements IInterfaceService {

    @Resource
    private InterfaceMapper interfaceMapper;

    @Override
    public List<Interface> query(){
        InterfaceExample example = new InterfaceExample();

        return interfaceMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Interface interfaces){
        if (interfaces.getId()!=null){
            interfaceMapper.updateByPrimaryKey((interfaces));
        }else {
            interfaceMapper.insert(interfaces);
        }
    }

    @Override
    public void deleteById(long id){
        interfaceMapper.deleteByPrimaryKey(id);
    }
}
